import React from 'react'; 
//引入需要用到的页面组件 
import Main from '../page/main'
import exhibitionList from '../page/exhibitionList';
import exhibition from '../page/exhibition'
import search from '../page/search'
import info from '../page/info'
//引入一些模块
import { BrowserRouter as Router, Route} from "react-router-dom";

class router extends React.Component{
    constructor(props){
        super(props)
    }
    render() {
        let routers = [
            {
                path: '/',
                component: Main
            },{
                path: '/exhibitionList',
                component: exhibitionList
            },{
                path: '/exhibition/detail/:id',
                component: exhibition
            },{
                path: '/exhibit/detail/:id',
                component: info
            },{
                path: '/search',
                component: search
            }
        ]
        return (
            <Router>
                {
                    routers.map((e,index) => {
                        return <Route 
                            exact={index==0?true:false} 
                            path={e.path} 
                            component={e.component}
                            key={index}
                        />
                    })
                }
            </Router>);
    }
}

export default router;